<?php

namespace app\admin\model\dts\approve;

use think\Model;


class Contract extends Model
{

    

    

    // 表名
    protected $name = 'dts_approve_contract';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'isprice_text',
        'status_text'
    ];
    

    
    public function getIspriceList()
    {
        return ['0' => __('Isprice 0'), '1' => __('Isprice 1')];
    }

    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '600' => __('Status 600'), '601' => __('Status 601'), '602' => __('Status 602'), '603' => __('Status 603'), '604' => __('Status 604'), '7' => __('Status 7')];
    }


    public function getIspriceTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['isprice']) ? $data['isprice'] : '');
        $list = $this->getIspriceList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
